Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <select> <option label="Volvo">Volvo (Latin for "I roll")</option> <option id="myOption" label="Mercedes">Mercedes (Mercedes-Benz)</option> </select> <p>Click the button to change the value of the label attribute of the Mercedes option.</p> <p><b>Tip:</b> Open the drop-down list before and after you have clicked the button.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myOption").label = "newLabel"; document.getElementById("demo").innerHTML = "The value of the label attribute was changed from 'Mercedes' to 'newLabel'."; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_option_label3 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:34:44 GMT --> </html>
Result:
Try it Yourself - © w3schools.com